package soundsystem;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @User: Alan
 * @Date: 2019/8/23
 * @Time: 10:07
 * @Description: soundsystem
 * @Version: 1.0
 */
@Component
public class CDPlayer {

    private CompactDisc cd;

    public CDPlayer() {
        super();
        System.out.println("CDPlayer无参构造函数");
    }

    @Autowired//自动装配
    public CDPlayer(CompactDisc cd) {
        this.cd = cd;
        System.out.println("CDPlayer有参构造函数");
    }

    public void play(){
        cd.play();
    }
}
